mirror your GitHub repos to tangled.org automatically
1

Configure Feed

Select the types of activity you want to include in your feed.

1import { and, eq } from 'drizzle-orm' 2import { repoMapping } from '~~/server/db/schema' 3import { useDb } from '~~/server/utils/db' 4import { requireSession } from '~~/server/utils/server-session' 5 6/** 7 * Pause sync for one mapping. The worker checks `disabledAt` on every push 8 * and skips disabled rows; we leave `status` alone so re-enabling restores 9 * the prior state. 10 */ 11export default defineEventHandler(async event => { 12 const session = await requireSession(event) 13 const mappingId = Number(getRouterParam(event, 'id')) 14 if (!Number.isFinite(mappingId)) { 15 throw createError({ statusCode: 400, statusMessage: 'invalid mapping id' }) 16 } 17 18 const db = useDb() 19 const updated = await db.update(repoMapping) 20 .set({ disabledAt: new Date(), updatedAt: new Date() }) 21 .where(and( 22 eq(repoMapping.id, mappingId), 23 eq(repoMapping.installationId, session.installationId), 24 )) 25 .returning({ id: repoMapping.id }) 26 if (updated.length === 0) { 27 throw createError({ statusCode: 404, statusMessage: 'mapping not found' }) 28 } 29 return { ok: true } 30})